package cn.itcast.bos.dao.base;

import domain.base.Courier;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

/**
 *使Dao层继承JpaSpecificationExecutor接口,获得带条件查找并分页封装的功能
 */

public interface CourierRepository extends JpaRepository<Courier,Integer>,JpaSpecificationExecutor{
    @Query(value = "update Courier set deltag = 1 where id in :ids")
    @Modifying
    void markDelTag(@Param("ids") List<Integer> list);

    @Query(value = "update Courier set deltag = 0 where id in :ids")
    @Modifying
    void restore(@Param("ids")List<Integer> list);
}
